# coding:utf-8
import tkinter as tk
root=tk.Tk()

v=tk.StringVar()

def test(content,reason,name):
    if content=="xc":
        print("正确！")
        print(content,reason,name)
        return True
    else:
        print("错误！")
        print(content,reason,name)
        return False



testCMD=root.register(test)
e1=tk.Entry(root,textvariable=v,validate="focusout",
                validatecommand=(testCMD,'%P','%v','%W'))
e2=tk.Entry(root)
e1.pack(pady=10,padx=10)
e2.pack(pady=10,padx=10)

tk.mainloop()